<?PHP
###############################################
# This file supply to service for web server 
# @2011-06-21
###############################################

class helper_mysql{
	public $conn;
	
	public function __construct(){
		$this->conn= mysql_connect(_DB_HOST,_DB_USER,_DB_PASSWORD);
		mysql_select_db(_DB_NAME);
	}

	public function __destruct(){
		$this->close();
	}

	public function close(){
		mysql_close($this->conn);
	}

	public function query($sql){
		return mysql_query($sql)or consol(mysql_error());
	}
	
	public function fetch_array($sql){ 
		return mysql_fetch_array($this->query($sql));
	}

	public function fetch_assoc($sql){ 
		$result = mysql_query($sql);
		return mysql_fetch_assoc($result);
	}
}


?>
